package weather;

import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;

/**
 *
 * @author Sebas
 */
public class WindDisplay implements Observer, DisplayElement {

    float speed;
    float visibility;
    char direction;
    Observable observable;

     public WindDisplay(Observable observable) {
        this.observable = observable;
        observable.addObserver(this);
    }

    public void update(Observable obs, Object arg) {
        if (obs instanceof WindData) {
            WindData wind = (WindData) obs;
            this.speed = (wind.getSpeed());
            this.visibility = (wind.getVisibility());
            this.direction = (wind.getDirection());
            display();
        }
    }

    public void display() {
        System.out.println("** Current wind conditions: " + speed
                + " miles per hour, " + visibility + " miles" + " and in " + direction + " direction. ");
    }
}
